﻿
@{
    Layout = null;
}
<!DOCTYPE html>
<html lang="en">
<!-- https://codepen.io/danielkvist/pen/LYNVyPL -->
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HuanFeng</title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
    @Scripts.Render("~/bundles/Jquery")
    @Scripts.Render("~/bundles/bootstrap")
    @Scripts.Render("~/bundles/jquery")
    <link href="~/Content/Css/Ger.css?v=888" rel="stylesheet" />
    <style>
        :root {
            /* COLORS */
            --white: #e9e9e9;
            --gray: #333;
            --blue: #0367a6;
            --lightblue: #008997;
            /*RADII*/
            --button-radius: 0.7rem;
            /*SIZES*/
            --max-width: 758px;
            --max-height: 420px;
            font-size: 16px;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
        }

        body {
            align-items: center;
            background-color: var(--white);
            background-image: url("/img//download3.jpg");
            background-attachment: fixed;
            background-position: center;
            background-repeat: no-repeat;
            background-size: cover;
            display: grid;
            height: 100vh;
            margin:0;
            place-items: center;
        }
    </style>
</head>
<body>
    <div class="container right-panel-active">
        <!-- Sign Up -->
        <div class="container__form container--signin">
            <form action="#" class="form" id="form1">
                <h2 class="form__title"></h2>
                <input type="text" placeholder="用户名" class="input" id="names" name="names" datatype="*2-12" errormsg="用户名至少2个字，最多12个字" />
                <input type="tel" placeholder="手机号" class="input" id="phones" name="phones" maxlength="11" />
                <input type="password" placeholder="密码" class="input" id="passss" datatype="*6-16" errormsg="密码最少6位，请重新填写！" />
                <lable style="font-size:12px;color:red">必须包含小写字母和数字的组合，不使用特殊字符，长度在 6-12 之间</lable>
                <button class="btn" id="zhuce">注  册</button>
            </form>
        </div>
        <!-- Sign In -->
        <div class="container__form container--signup">
            <form action="~/Login/Loginie" class="form" id="form2" method="post">
                <h2 class="form__title">登 录</h2>
                <select id="DEquanxian" name="DEquanxian" class="input" style=" width: 110%; color: #757575;display:none">
                    <option value="管理员">管理员</option>
                    <option value="员工">员工</option>
                    @*<option value="ERP成员">ERP成员</option>*@
                </select>
                <input type="text" placeholder="用户名" class="input" id="DEname" name="DEname" />
                <input type="password" placeholder="密码" class="input" id="DEpass" name="DEpass" />
                <a href="#" class="link">忘记密码?</a>
                <input type="button" class="btn" value="登  录" id="denglu">
            </form>
        </div>
        <!-- Overlay -->
        <div class="container__overlay">
            <div class="overlay">
                <div class="overlay__panel overlay--left" style="display:none">
                    <button class="btn" id="">注 册</button>
                </div>
                <div class="overlay__panel overlay--right">
                    <button class="btn" id="signUp">登 录</button>
                </div>
            </div>
        </div>
    </div>
    <script src="~/Scripts/jquery-3.4.1.js"></script>
    <script>
       // const signInBtn = document.getElementById("signIn");
        const signUpBtn = document.getElementById("signUp");
        const fistForm = document.getElementById("form1");
        const secondForm = document.getElementById("form2");
        const container = document.querySelector(".container");

        /*signInBtn.addEventListener("click", () => {
            container.classList.remove("right-panel-active");
        });*/

        signUpBtn.addEventListener("click", () => {
            container.classList.add("right-panel-active");
        });

        fistForm.addEventListener("submit", (e) => e.preventDefault());
        secondForm.addEventListener("submit", (e) => e.preventDefault());
        $(function () {
            $("#denglu").click(function () {
                var ghj = $("#DEquanxian").val()
                var ghjs = $("#DEname").val()
                var ghjw = $("#DEpass").val()
                console.log(ghj + ghjs + ghjw);
                $.ajax({
                    url: '/Login/Loginie',
                    type: 'POST',
                    data: { "DEname": ghjs, "DEpass": ghjw },
                    success: function (date) {
                        if (date == 1) {
                            alert("用户名或密码输入错误！")
                        } else {
                            $.ajax({
                                url: '/Home/Index',
                                type: 'POST',
                                data: { "BB_SQ_xmmc": ghjs, "BB_SQ_khmc": ghjw, "states": 14 },
                                success: function (date) {
                                    window.location.href = "/Home/Zuye"
                                }, error: function () {
                                    alert("系统错误")
                                }
                            })
                            
                        }

                    },
                    error: function () {
                        alert("错误 请重试！")
                    }
                })
            })
            
            $("#zhuce").click(function () {
                var ghj = $("#names").val()
                var ghjs = $("#phones").val()
                var ghjw = $("#passss").val()
                let qim = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
                let shuned = ghjs.match(qim)
                let mmoki = /^(?=.*\d)(?=.*[a-z])[a-zA-Z0-9]{6,12}$/
                let jismam = ghjw.match(mmoki)
                console.log(jismam)
                if (ghj == "") {
                    alert("请输入用户名")
                } else if (shuned == null) {
                    alert("请输入正确的手机号")
                } else if (ghjw == "") {
                    alert("密码不能为空")
                } else if (jismam == null) { alert("密码输入不正确！") }
                else {
                    /*$.ajax({
                        url: '/Login/Loginiewe',
                        type: 'POST',
                        data: { "DEname": ghj, "DEpass": ghjw, "DEphone": ghjs },
                        success: function (date) {
                            alert(date)
                            location.reload(true)
                        },
                        error: function () {
                            alert("错误 请重试！")
                        }
                    })*/
                }
            })

            
        })
    </script>
</body>
</html>